﻿using System;
using nRoute.Controllers.Mapping;
using nRoute.Controllers;
using System.Windows;
using nRoute.ViewServices.Contracts;
using nRoute.Components.Composition;

namespace nRoute.Samples.OfficerXcel.Controllers
{
    [MapController("Shell/Options/{action}")]
    public class ShellOptionsController
        : Controller
    {
        private readonly IShowMessageViewService _messageViewService;

        [ResolveConstructor]
        public ShellOptionsController(IShowMessageViewService messageViewService)
        {
            if (messageViewService == null) throw new ArgumentNullException("messageViewService");
            _messageViewService = messageViewService;
        }

        [ActionName("Settings")]
        public ActionResult ShowSettings()
        {
            return new NavigateResult("Dialogs/OptionsDialog");
        }

        [ActionName("Exit")]
        public void ExitApplication()
        {
            _messageViewService.ButtonSetup = MessageBoxButton.OK;
            _messageViewService.Text = "Exit is not supported";
            _messageViewService.ShowMessage();
        }
    }
}
